-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for @annotations
#1439
base: master
Are you sure you want to change the base?
Conversation
A more targeted version of --allow-undefined
Removes item from output of write_array and related methods. Needs careful consideration on how this interacts with unconstrain_array function
130d15d
to
0013492
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1439 +/- ##
==========================================
- Coverage 89.49% 89.48% -0.02%
==========================================
Files 63 65 +2
Lines 10618 10642 +24
==========================================
+ Hits 9503 9523 +20
- Misses 1115 1119 +4
|
In the design doc discussion, I'd prefer formatting the annotation on its own line (like a Python function decorator)
This is more or less required for longer parametrized annotations, such as the hypothetical Checking that the annotation belongs to a list of known annotations may be enough to catch typos, but you should also warn about inapplicable annotations (e.g. |
Formatting is currently set up with a hv box, so it will fit on one line if it can, but as soon as it can't, every annotation will appear on its own line. We could easily use a vbox instead if that's preferred -- I have a slight preference towards saving lines if they're short annotations More advanced warnings are definitely something I want to look at before this becomes a non-draft; part of the issue is a lot of annotation logic will inherently live in the lower parts of the compiler, which currently never emit warnings, so wiring it up in a reasonable way requires some thinking |
Initial implementation of https://github.com/stan-dev/design-docs/blob/master/designs/0033-declaration-annotations.md:
@annotations
on declaration nodes, propagation of this information throughout compiler.@extern
example from the design doc, can be placed on functions to silence the declared-but-undefined typechecking error function-by-function@silent
, which allows a parameter which is not output by write_array. Particularly useful for custom transforms withjacobian+=
where the "raw" form is not desired.Note: This feature does lead to models which prohibit certain features like standalone generated quantities.
Submission Checklist
Release notes
@extern
can now be placed before a function declaration to mark it as defined in an external C++ file@silent
can be placed on a variable in one of the output blocks (e.g.parameters
) to prevent it from appearing in the CSV output.Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)